﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Happy.Query.Filters.Internal
{
    internal static class OperatorExtentions
    {
        private static readonly Dictionary<Operator, string> _SqlFragmentFormats = new Dictionary<Operator, string>
        {
            { Operator.Equal, "{0} = {1}" },
            { Operator.NotEqual, "{0} != {1}" },
            { Operator.GreaterThan, "{0} > {1}" },
            { Operator.LessThan, "{0} < {1}" },
            { Operator.GreaterThanOrEquals, "{0} >= {1}" },
            { Operator.LessThanOrEquals, "{0} <= {1}" },
            { Operator.Contains, "{0} LIKE {1}" },
            { Operator.NotContains, "{0} NOT LIKE {1}" },
            { Operator.Between, "{0} BETWEEN {1} AND {2}" },
            { Operator.NotBetween, "{0} NOT BETWEEN {1} AND {2}" },
         };

        public static string ToSqlFragmentFormat(this Operator that)
        {
            return _SqlFragmentFormats[that];
        }
    }
}
